package ee.reliability.tool.util;

import java.util.Date;

@SuppressWarnings("serial")
public class Day extends Date {
	private final int day;
	private final int month;

	public Day(int day, int month) {
		this.day = day;
		this.month = month;
	}

	public Day(String dayMonthString) {
		String[] arr = dayMonthString.split("\\.");
		day = Integer.parseInt(arr[0]);
		month = Integer.parseInt(arr[1]);
	}

	@SuppressWarnings("deprecation")
	@Override
	public boolean equals(Object obj) {
		return obj instanceof Date
				&& day == ((Date) obj).getDate()
				&& month == ((Date) obj).getMonth() + 1;
	}

}
